<?php
session_start();
class Profile extends CI_Controller {

	public function __construct()
	{
		parent::__construct();
		$this->load->model("teams_db");
		$this->load->model("profile_db");
		$this->load->helper("coach_profile_helper");
	}

	public function coach()
	{
		$data['base'] = $this->config->item('base_url');
		$data['css'] = $data['base'].$this->config->item('css');
		$data['images'] = $data['base'].$this->config->item('images');
		$data['js'] = $data['base'].$this->config->item('js');
		
		$data['head']['css'] = array('main' => 'main.css');

		$data["teams"] = $this->teams_db->get_teams();

		//combine the following 3 methods?
		$data['name'] = $this->profile_db->get_coach_name(); 
		$data['school'] = $this->profile_db->get_coach_school();
		$coach_id = $this->profile_db->get_coach_school();
		
		$data['favorites'] = $this->profile_db->get_favorites($coach_id);
		$data['favorites'] = calculate_seva_score($data['favorites']);
		$data['recommended'] = $this->profile_db->get_recommended($coach_id);
		$data['recommended'] = calculate_seva_score($data['recommended']);
		
		//write method the gets newsfeed
		$data['newsfeed'] = $this->profile_db->get_news_feed($coach_id);
		
		$data = $this->profile_db->get_coach_lists($coach_id, $data);
		
		//the stuff that we see
		$this->load->view('templates/header', $data);
		$this->load->view('profile/index', $data);
		$this->load->view('profile/tabs', $data);
		$this->load->view('templates/footer');

	}
	
	public function player()
	{
		$data['base'] = $this->config->item('base_url');
		$data['css'] = $data['base'].$this->config->item('css');
		$data['images'] = $data['base'].$this->config->item('images');
		$data['js'] = $data['base'].$this->config->item('js');
		
		$data['head']['css'] = array('main' => 'main.css');

		$data["teams"] = $this->teams_db->get_teams();

		$player_id = 555; //pull from SESSION
		//write a method that pulls these from a database
		$data['name'] = $this->profile_db->get_player_name($player_id); 
		$data['school'] = $this->profile_db->get_player_school($player_id);

		//write a method that gets favorite info
		$data['favorite_schools'] = $this->profile_db->get_favorite_schools($player_id);
		
		$data['player_stats'] = $this->profile_db->get_player_stats($player_id);
		$data = $this->profile_db->get_bio_info($player_id, $data);
		$data = $this->profile_db->get_film_urls($player_id, $data);
		
		
		
		
		
		$this->load->view('templates/header', $data);
		$this->load->view('profile/index2', $data);
		$this->load->view('teams/index2', $data);
		//$this->load->view('profile/favorites', $data);
		//$this->load->view('profile/spotlight', $data);
		//$this->load->view('profile/whatshot', $data);
		$this->load->view('profile/tabs2', $data);
		$this->load->view('templates/footer');
		print_r($data); //debugging
	}
	

}